<cffunction
	name="sap_encrypt"
	hint="Encrypts a string using the application.sap_encryption_key variable set via SQL for passing to XI/SAP"
	access="package"
	output="false"
	returntype="string">
	
	<cfargument name="originalData" type="string" required="true">
	
	<cfscript>
		var.sap_encryption_util = createObject("java","UtilEncrypt");
		var.sap_encryption_key = application.sap_encryption_key;
		var.sap_encryption_originalData = arguments.originalData;
		var.sap_encryption_encodeEncryptData = util.encrypt( key, originalData, "");
	</cfscript>
	
	<cfreturn var.sap_encryption_encodeEncryptData>
</cffunction>

<cffunction
	name="sap_decrypt"
	hint="Decodes a string using the application.sap_encryption_key variable set via SQL for passing to XI/SAP"
	access="package"
	output="false"
	returntype="string">
	
	<cfargument name="encryptedData" type="string" required="true">
	
	<cfscript>
		var.sap_decryption_util = createObject("java","UtilEncrypt");
		var.sap_decryption_key = application.sap_encryption_key;
		var.sap_decryption_encodeEncryptData = arguments.encryptedData;
		var.sap_decryption_originalData = util.decrypt(key, encodeEncryptData, "" );
	</cfscript>
	
	<cfreturn var.sap_decryption_originalData>
</cffunction>